function [mean_error, log_likeli]=Likelihood(fx,sigma,measurements)
%% Likelihood ------------------------------------------
%INPUT - fx           -- calculated state variables by forward modeling
%        sigma        -- measurement error expressed by standard deviation
%        measurements -- meauresed state variables 
%        N            -- number of observation values 
%OUTPUT -   log_likeli  --  log likelihood value in each chain
%       -   mean_error  --  calculated errors 
        weight=10.0;
        N= size(fx,1)*size(fx,2);
        fx1=reshape(fx,[N,1]);
        measure=reshape(measurements,[N,1]);
        e=(fx1-measure)*weight;
        mean_error=sqrt(sum(e.^2.0))/N;
        log_likeli = - ( N /2.0) *log(2.0 * pi) -N * log( sigma) - 0.5 * (sigma^-2.0) * sum( e.^2.0);
         
 end
